
if(COMMAND cmake_minimum_required)
   cmake_minimum_required(VERSION 2.4)
endif(COMMAND cmake_minimum_required)

if(COMMAND cmake_policy)
	if(POLICY CMP0003)
		cmake_policy(SET CMP0003 OLD)
	endif(POLICY CMP0003)
	if(POLICY CMP0005)
		cmake_policy(SET CMP0005 OLD)
	endif(POLICY CMP0005)
	if(POLICY CMP0011)
		cmake_policy(SET CMP0011 OLD) # or NEW
	endif(POLICY CMP0011)
endif(COMMAND cmake_policy)


PROJECT(Packing)

SET(GEEX_BUILD_PATH ${PROJECT_BINARY_DIR})
SET(BINARIES_RELATIVE_PATH /binaries/bin/)

 
SET(BUILD_SHARED_LIBS ON)

IF (WIN32)
    SET(LIBRARIES_RELATIVE_PATH /binaries/bin/)
ELSE(WIN32)
    SET(LIBRARIES_RELATIVE_PATH /binaries/lib/)
ENDIF(WIN32)

IF(WIN32)
    SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}${BINARIES_RELATIVE_PATH})
ELSE(WIN32)
    SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}${LIBRARIES_RELATIVE_PATH})
ENDIF(WIN32)

SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}${BINARIES_RELATIVE_PATH})

IF (EXISTS ${CMAKE_SOURCE_DIR}/CMakeOptions.txt)
   MESSAGE(INFO: "Using local options file: " ${CMAKE_SOURCE_DIR}/CMakeOptions.txt)
   INCLUDE(${CMAKE_SOURCE_DIR}/CMakeOptions.txt)
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/CMakeOptions.txt)

IF(USES_SSE)
   IF(WIN32)
       SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MP")
       SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP")
       SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DGX_SSE /arch:SSE2 /Oi /Ot /MP")
       SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DGX_SSE /arch:SSE2 /Oi /Ot /MP")
   ELSE(WIN32)
       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGX_SSE -DUNIX")
       SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DGX_SSE -DUNIX")
   ENDIF(WIN32)
ELSE(USES_SSE)
   IF(WIN32)
       SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MP")
       SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP")
       SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi /Ot /MP")
       SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /Ot /MP")
   ELSE(WIN32)
       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNIX")
       SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DUNIX")
   ENDIF(WIN32)
ENDIF(USES_SSE)

IF(WITH_GINAC) 
       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGX_GINAC")
       SET(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DGX_GINAC")
ENDIF(WITH_GINAC)

add_definitions(-DCGAL_CFG_NO_CPP0X_ISFINITE)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR})
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Geex/third_party)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/Geex/third_party/AntTweakBar/include)

ADD_SUBDIRECTORY(Geex)
#ADD_SUBDIRECTORY(gx_ccvt)
ADD_SUBDIRECTORY(packing)
ADD_SUBDIRECTORY(particle-circle)
ADD_SUBDIRECTORY(particle-polygon)
ADD_SUBDIRECTORY(field-polygon)
ADD_SUBDIRECTORY(common)

IF(WIN32)
  MESSAGE("Configure done. You may need to click on configure again if the OK button is disabled")
ENDIF(WIN32)

